<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://www.cuahsi.org/waterML/1.0/" elementFormDefault="qualified" targetNamespace="http://www.cuahsi.org/waterML/1.0/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="note">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="type" type="xs:string" />
          <xs:attribute name="href" type="xs:string" />
          <xs:attribute name="show" type="xs:string" />
          <xs:attribute name="title" type="xs:string" />
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="option">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="name" type="xs:string" />
          <xs:attribute name="optionCode" type="xs:string" />
          <xs:attribute name="optionID" type="xs:integer" />
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="options">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="option" nillable="true">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="name" type="xs:string" />
                <xs:attribute name="optionCode" type="xs:string" />
                <xs:attribute name="optionID" type="xs:integer" />
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="qualifier">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="qualifierCode" type="xs:string" />
          <xs:attribute name="qualifierID" type="xs:integer" />
          <xs:attribute name="metadataDateTime" type="xs:anySimpleType" />
          <xs:attribute name="oid" type="xs:string" />
          <xs:attribute name="default" type="xs:boolean" />
          <xs:attribute name="network" type="xs:string" />
          <xs:attribute name="vocabulary" type="xs:string" />
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="qualityControlLevel">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="qualityControlLevelID" type="xs:string" />
      </xs:sequence>
      <xs:attribute name="qualityControlLevelCode" type="xs:string" />
      <xs:attribute name="metadataDateTime" type="xs:anySimpleType" />
      <xs:attribute name="oid" type="xs:string" />
      <xs:attribute name="default" type="xs:boolean" />
      <xs:attribute name="network" type="xs:string" />
      <xs:attribute name="vocabulary" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:element name="timeSeriesResponse" type="tns:TimeSeriesResponseType" />
  <xs:element name="timeZoneInfo">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="defaultTimeZone" nillable="true">
          <xs:complexType>
            <xs:sequence />
            <xs:attribute name="ZoneAbbreviation" type="xs:string" />
            <xs:attribute name="ZoneOffset" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
        <xs:element name="daylightSavingsTimeZone" nillable="true">
          <xs:complexType>
            <xs:sequence />
            <xs:attribute name="ZoneAbbreviation" type="xs:string" />
            <xs:attribute name="ZoneOffset" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="timeseriesresponsetype" type="tns:TimeSeriesResponseType" />
  <xs:element name="units">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="unitsAbbreviation" type="xs:string" />
          <xs:attribute name="unitsCode" type="xs:string" />
          <xs:attribute name="unitsType" type="tns:unitsTypeEnum" />
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:element name="variableCode">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="variableID" type="xs:integer" />
          <xs:attribute name="default" type="xs:boolean" />
          <xs:attribute name="network" type="xs:string" />
          <xs:attribute name="vocabulary" type="xs:string" />
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="TimeSeriesResponseType">
    <xs:sequence>
      <xs:element name="queryInfo" type="tns:QueryInfoType" />
      <xs:element maxOccurs="unbounded" name="timeSeries" type="tns:TimeSeriesType" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="QueryInfoType">
    <xs:sequence>
      <xs:element minOccurs="0" name="creationTime" type="xs:anySimpleType" />
      <xs:element minOccurs="0" name="queryURL" type="xs:string" />
      <xs:element minOccurs="0" name="querySQL" type="xs:string" />
      <xs:element minOccurs="0" name="criteria">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="locationParam" type="xs:string" />
            <xs:element minOccurs="0" name="variableParam" type="xs:string" />
            <xs:element minOccurs="0" name="timeParam">
              <xs:complexType>
                <xs:sequence>
                  <xs:element minOccurs="0" name="beginDateTime" type="xs:string" />
                  <xs:element minOccurs="0" name="endDateTime" type="xs:string" />
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element maxOccurs="unbounded" ref="tns:note" />
      <xs:element name="extension" type="xs:anyType" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TimeSeriesType">
    <xs:sequence>
      <xs:element name="sourceInfo" type="tns:SourceInfoType" />
      <xs:element name="variable" type="tns:VariableInfoType" />
      <xs:element maxOccurs="unbounded" name="values" type="tns:TsValuesSingleVariableType" />
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required" />
  </xs:complexType>
  <xs:complexType name="SourceInfoType">
    <xs:sequence />
  </xs:complexType>
  <xs:complexType name="SiteInfoType">
    <xs:complexContent mixed="false">
      <xs:extension base="tns:SourceInfoType">
        <xs:sequence>
          <xs:element name="siteName" type="xs:string" />
          <xs:element maxOccurs="unbounded" name="siteCode">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="defaultId" type="xs:boolean" />
                  <xs:attribute name="network" type="xs:string" use="required" />
                  <xs:attribute name="siteID" type="xs:string" />
                </xs:extension>
              </xs:simpleContent>
            </xs:complexType>
          </xs:element>
          <xs:element minOccurs="0" ref="tns:timeZoneInfo" />
          <xs:element minOccurs="0" name="geoLocation">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="geogLocation" type="tns:GeogLocationType" />
                <xs:element minOccurs="0" maxOccurs="unbounded" name="localSiteXY" nillable="true">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="X" type="xs:double" />
                      <xs:element name="Y" type="xs:double" />
                      <xs:element minOccurs="0" name="Z" type="xs:double" />
                      <xs:element minOccurs="0" maxOccurs="unbounded" name="note" nillable="true">
                        <xs:complexType>
                          <xs:simpleContent>
                            <xs:extension base="xs:string">
                              <xs:attribute name="type" type="xs:string" />
                              <xs:attribute name="href" type="xs:string" />
                              <xs:attribute name="show" type="xs:string" />
                              <xs:attribute name="title" type="xs:string" />
                            </xs:extension>
                          </xs:simpleContent>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                    <xs:attribute name="projectionInformation" type="xs:string" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
            </xs:complexType>
          </xs:element>
          <xs:element minOccurs="0" name="elevation_m" type="xs:double" />
          <xs:element minOccurs="0" name="verticalDatum" type="xs:string" />
          <xs:element minOccurs="0" maxOccurs="unbounded" name="note" nillable="true">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="type" type="xs:string" />
                  <xs:attribute name="href" type="xs:string" />
                  <xs:attribute name="show" type="xs:string" />
                  <xs:attribute name="title" type="xs:string" />
                </xs:extension>
              </xs:simpleContent>
            </xs:complexType>
          </xs:element>
          <xs:element name="extension" type="xs:anyType" />
          <xs:element name="altname" type="xs:anyType" />
        </xs:sequence>
        <xs:attribute name="metadataDateTime" type="xs:anySimpleType" />
        <xs:attribute name="oid" type="xs:string" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="GeogLocationType">
    <xs:sequence />
    <xs:attribute name="srs" type="xs:string" />
  </xs:complexType>
  <xs:complexType name="LatLonBoxType">
    <xs:complexContent mixed="false">
      <xs:extension base="tns:GeogLocationType">
        <xs:sequence>
          <xs:element name="south" type="xs:double" />
          <xs:element name="west" type="xs:double" />
          <xs:element name="north" type="xs:double" />
          <xs:element name="east" type="xs:double" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="LatLonPointType">
    <xs:complexContent mixed="false">
      <xs:extension base="tns:GeogLocationType">
        <xs:sequence>
          <xs:element name="latitude" type="xs:double" />
          <xs:element name="longitude" type="xs:double" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="VariableInfoType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" ref="tns:variableCode" />
      <xs:element minOccurs="0" name="variableName" type="xs:string" />
      <xs:element minOccurs="0" name="variableDescription" type="xs:string" />
      <xs:element minOccurs="0" name="valueType" type="tns:valueTypeEnum" />
      <xs:element minOccurs="0" name="dataType" type="tns:dataTypeEnum" />
      <xs:element minOccurs="0" name="generalCategory" type="tns:generalCategoryEnum" />
      <xs:element minOccurs="0" name="sampleMedium" type="tns:sampleMediumEnum" />
      <xs:element minOccurs="0" ref="tns:units" />
      <xs:element minOccurs="0" ref="tns:options" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="note" nillable="true">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="type" type="xs:string" />
              <xs:attribute name="href" type="xs:string" />
              <xs:attribute name="show" type="xs:string" />
              <xs:attribute name="title" type="xs:string" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" name="related">
        <xs:complexType>
          <xs:sequence>
            <xs:choice maxOccurs="unbounded">
              <xs:element name="parentID">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="default" type="xs:boolean" />
                      <xs:attribute name="network" type="xs:string" />
                      <xs:attribute name="vocabulary" type="xs:string" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="relatedID">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="default" type="xs:boolean" />
                      <xs:attribute name="network" type="xs:string" />
                      <xs:attribute name="vocabulary" type="xs:string" />
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element minOccurs="0" name="extension" type="xs:anyType" />
      <xs:element minOccurs="0" name="NoDataValue" type="xs:string" />
      <xs:element minOccurs="0" name="timeSupport">
        <xs:complexType>
          <xs:sequence>
            <xs:element minOccurs="0" name="unit" type="tns:UnitsType" />
            <xs:element minOccurs="0" name="timeInterval" type="xs:int" />
          </xs:sequence>
          <xs:attribute name="isRegular" type="xs:boolean" />
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="metadataDateTime" type="xs:anySimpleType" />
    <xs:attribute name="oid" type="xs:string" />
  </xs:complexType>
  <xs:complexType name="UnitsType">
    <xs:sequence>
      <xs:element name="UnitName" type="xs:string" />
      <xs:element name="UnitDescription" type="xs:string" />
      <xs:element name="UnitType" type="tns:unitsTypeEnum" />
      <xs:element name="UnitAbbreviation" type="xs:string" />
    </xs:sequence>
    <xs:attribute name="UnitID" type="xs:int" />
  </xs:complexType>
  <xs:complexType name="TsValuesSingleVariableType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" name="value" type="tns:ValueSingleVariable" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="qualifier" nillable="true">
        <xs:complexType>
          <xs:simpleContent>
            <xs:extension base="xs:string">
              <xs:attribute name="qualifierCode" type="xs:string" />
              <xs:attribute name="qualifierID" type="xs:integer" />
              <xs:attribute name="metadataDateTime" type="xs:anySimpleType" />
              <xs:attribute name="oid" type="xs:string" />
              <xs:attribute name="default" type="xs:boolean" />
              <xs:attribute name="network" type="xs:string" />
              <xs:attribute name="vocabulary" type="xs:string" />
            </xs:extension>
          </xs:simpleContent>
        </xs:complexType>
      </xs:element>
      <xs:element ref="tns:qualityControlLevel" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="method" nillable="true" type="tns:MethodType" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="source" nillable="true" type="tns:SourceType" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="offset" nillable="true" type="tns:OffsetType" />
    </xs:sequence>
    <xs:attribute name="count" type="xs:integer" />
    <xs:attribute name="timeZoneShiftApplied" type="xs:boolean" />
    <xs:attribute name="unitsAreConverted" type="xs:boolean" />
    <xs:attribute name="unitsAbbreviation" type="xs:string" />
    <xs:attribute name="unitsCode" type="xs:string" />
    <xs:attribute name="unitsType" type="tns:unitsTypeEnum" />
  </xs:complexType>
  <xs:complexType name="ValueSingleVariable">
    <xs:simpleContent>
      <xs:extension base="xs:decimal">
        <xs:attribute name="offsetDescription" type="xs:string" />
        <xs:attribute name="offsetTypeID" type="xs:int" />
        <xs:attribute name="offsetUnitsAbbreviation" type="xs:string" />
        <xs:attribute name="offsetUnitsCode" type="xs:string" />
        <xs:attribute name="offsetValue" type="xs:double" />
        <xs:attribute name="accuracyStdDev" type="xs:double" />
        <xs:attribute name="censorCode" type="tns:censorCodeEnum" />
        <xs:attribute name="codedVocabulary" type="xs:boolean" />
        <xs:attribute name="codedVocabularyTerm" type="xs:string" />
        <xs:attribute name="dateTime" type="xs:anySimpleType" />
        <xs:attribute name="methodID" type="xs:string" />
        <xs:attribute name="qualifiers" type="xs:string" />
        <xs:attribute name="qualityControlLevel" type="tns:qualityControlLevelEnum" />
        <xs:attribute name="sampleID" type="xs:string" />
        <xs:attribute name="sourceID" type="xs:string" />
        <xs:attribute name="metadataDateTime" type="xs:anySimpleType" />
        <xs:attribute name="oid" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="MethodType">
    <xs:sequence>
      <xs:element name="MethodDescription" type="xs:string" />
      <xs:element name="MethodLink" type="xs:string" />
    </xs:sequence>
    <xs:attribute name="methodID" type="xs:int" />
  </xs:complexType>
  <xs:complexType name="SourceType">
    <xs:sequence>
      <xs:element minOccurs="0" name="Organization" type="xs:string" />
      <xs:element minOccurs="0" name="SourceDescription" type="xs:string" />
      <xs:element minOccurs="0" name="Metadata" type="tns:MetaDataType" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="ContactInformation" type="tns:ContactInformationType" />
      <xs:element minOccurs="0" name="SourceLink" type="xs:string" />
    </xs:sequence>
    <xs:attribute name="sourceID" type="xs:int" />
  </xs:complexType>
  <xs:complexType name="MetaDataType">
    <xs:sequence>
      <xs:element name="TopicCategory" type="xs:string" />
      <xs:element name="Title" type="xs:string" />
      <xs:element name="Abstract" type="xs:string" />
      <xs:element name="ProfileVersion" type="xs:string" />
      <xs:element name="MetadataLink" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="ContactInformationType">
    <xs:sequence>
      <xs:element name="ContactName" type="xs:string" />
      <xs:element minOccurs="0" name="TypeOfContact" type="xs:string" />
      <xs:element minOccurs="0" name="Phone" type="xs:string" />
      <xs:element minOccurs="0" name="Email" type="xs:string" />
      <xs:element minOccurs="0" name="Address" type="xs:anyType" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="OffsetType">
    <xs:sequence>
      <xs:element minOccurs="0" name="offsetValue" type="xs:float" />
      <xs:element minOccurs="0" name="offsetDescription" type="xs:string" />
      <xs:element ref="tns:units" />
      <xs:element minOccurs="0" default="true" name="offsetIsVertical" type="xs:boolean" />
      <xs:element minOccurs="0" name="offsetHorizDirectionDegrees" type="xs:int" />
    </xs:sequence>
    <xs:attribute name="offsetTypeID" type="xs:int" />
  </xs:complexType>
  <xs:simpleType name="valueTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Field Observation" />
      <xs:enumeration value="Sample" />
      <xs:enumeration value="Model Simulation Result" />
      <xs:enumeration value="Derived Value" />
      <xs:enumeration value="Unknown" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="dataTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Continuous" />
      <xs:enumeration value="Instantaneous" />
      <xs:enumeration value="Cumulative" />
      <xs:enumeration value="Incremental" />
      <xs:enumeration value="Average" />
      <xs:enumeration value="Maximum" />
      <xs:enumeration value="Minimum" />
      <xs:enumeration value="Constant Over Interval" />
      <xs:enumeration value="Categorical" />
      <xs:enumeration value="Best Easy Systematic Estimator " />
      <xs:enumeration value="Unknown" />
      <xs:enumeration value="Variance" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="generalCategoryEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Water Quality" />
      <xs:enumeration value="Climate" />
      <xs:enumeration value="Hydrology" />
      <xs:enumeration value="Geology" />
      <xs:enumeration value="Biota" />
      <xs:enumeration value="Unknown" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="sampleMediumEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Surface Water" />
      <xs:enumeration value="Ground Water" />
      <xs:enumeration value="Sediment" />
      <xs:enumeration value="Soil" />
      <xs:enumeration value="Air" />
      <xs:enumeration value="Tissue" />
      <xs:enumeration value="Precipitation" />
      <xs:enumeration value="Unknown" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="unitsTypeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Angle" />
      <xs:enumeration value="Area" />
      <xs:enumeration value="Dimensionless" />
      <xs:enumeration value="Energy" />
      <xs:enumeration value="Energy Flux" />
      <xs:enumeration value="Flow" />
      <xs:enumeration value="Force" />
      <xs:enumeration value="Frequency" />
      <xs:enumeration value="Length" />
      <xs:enumeration value="Light" />
      <xs:enumeration value="Mass" />
      <xs:enumeration value="Permeability" />
      <xs:enumeration value="Power" />
      <xs:enumeration value="Pressure/Stress" />
      <xs:enumeration value="Resolution" />
      <xs:enumeration value="Scale" />
      <xs:enumeration value="Temperature" />
      <xs:enumeration value="Time" />
      <xs:enumeration value="Velocity" />
      <xs:enumeration value="Volume" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="censorCodeEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="lt" />
      <xs:enumeration value="gt" />
      <xs:enumeration value="nc" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="qualityControlLevelEnum">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Raw data" />
      <xs:enumeration value="Quality controlled data" />
      <xs:enumeration value="Derived products" />
      <xs:enumeration value="Interpreted products" />
      <xs:enumeration value="Knowledge products" />
      <xs:enumeration value="Unknown" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>